/*
**********************************************************************************
 ECE 527 Project 3
 Description: Implementation of 64 bit Ling's adder 

 Team : Rohit Kulkarni
        Akshay Kotian
**********************************************************************************
*/

module ling_adder_64
(
	input [63:0]  a,
	input [63:0]  b,
	input Cin,
	output [63:0] S,
	output Cout
);

wire [66:0] t;
wire [66:0] g;
wire [66:0] h;

genvar i;

generate
	for(i = 1; i < 65; i=i+1)
	begin
		assign 	t[0] 	 = 1;
		assign  h[0]	 = Cin;
		assign	h[1]	 = Cin;
		assign 	t[i]	 = a[i-1] | b[i-1];
		assign	g[i] 	 = a[i-1] & b[i-1];
		assign 	h[i+1]   = g[i] | (t[i-1] & h[i]);
		assign 	S[i-1]	 = (t[i] ^ h[i+1]) | (g[i] & h[i] & t[i-1]);
		assign  Cout 	 = h[i+1] & t[i];
	end
endgenerate

endmodule
